package com.college.common.exception;

import com.college.common.constant.ExceptionHandler;

/**
 * Api异常类
 */
public class ApiException extends RuntimeException {

	private ExceptionHandler exceptionHandler;

	private String errorValue = "";

	private int errorCode = 500;

	public ApiException(ExceptionHandler exceptionHandler) {
		super(exceptionHandler.getMessage());
		this.exceptionHandler = exceptionHandler;
	}

	public ApiException(String message) {
		super(message);
	}

	public ApiException(Throwable cause) {
		super(cause);
	}

	public ApiException(int errorCode, String errorValue) {
		super(errorCode + " : " + errorValue);
		this.errorCode = errorCode;
		this.errorValue = errorValue;
	}

	public ApiException(String message, Throwable cause) {
		super(message, cause);
	}

	public ExceptionHandler getErrorCode() {
		return exceptionHandler;
	}
}